package com.itheima.day15.work1;

import java.io.IOException;
import java.net.*;
import java.util.Random;
import java.util.Scanner;

public class ClientDemo2 {
    public static void main(String[] args) throws IOException {
        DatagramSocket  ds=new DatagramSocket();
        InetAddress byName = InetAddress.getByName("127.0.0.1");
        Scanner sc=new Scanner(System.in);
        while (true) {
            String s = sc.nextLine();
            if (s.equals("886")){
                break;
            }
            byte[] bytes = s.getBytes();
            // int length = bytes.length;
            int port=10001;
            DatagramPacket dp=new DatagramPacket(bytes,bytes.length,byName,port);
            ds.send(dp);
        }
        ds.close();
    }
}
